import request from "@/utils/request"

import store from '@/store'

export const Login = (data) => {
    return request({
        method: 'POST',
        url: '/v1_0/authorizations',
        data: data
    })
}

export const SendSMS = (mobile) => {
    return request({
        method: 'GET',
        url: `/v1_0/sms/codes/${mobile}`,
    })
}

export const getUserInfo = () => {
    return request({
        method: 'GET',
        url: 'v1_0/user'
            // headers: {
            //     Authorization: `Bearer ${store.state.user.token}`
            // }
    })
}

export const getUserChannels = () => {
    return request({
        method: 'GET',
        url: '/v1_0/channels'
    })
}

export const getUserProfile = (target) => {
    return request({
        method: 'GET',
        url: '/v1_0/user/profile'
    })
}
export const updateUserProfile = (data) => {
    return request({
        method: 'PATCH',
        url: '/v1_0/user/profile',
        data
    })
}